# Maintainer: PiSugar <pisugar.zero@gmail.com>
pkgname=pisugar-bin
pkgver=1.7.8
pkgrel=1
pkgdesc="PiSugar"
arch=('arm' 'armv7h' 'aarch64' 'x86_64')
url="https://github.com/PiSugar/pisugar-power-manager-rs"
license=('GPL')
groups=()
depends=()
makedepends=()
optdepends=()
provides=('pisugar-server' 'pisugar-poweroff')
conflicts=()
replaces=()
backup=()
options=()
install=pisugar-bin.install
changelog=
source=("${pkgname}_${pkgver}_all.tar.gz")
noextract=()

package() {
    cd "$CARCH"
    install -Dm755 pisugar-server -t "$pkgdir/usr/bin/"
    install -Dm644 pisugar-server.default -t "$pkgdir/etc/default/pisugar-server"
    install -Dm644 pisugar-server.service -t "$pkgdir/usr/lib/systemd/system"
    install -Dm644 config.json -t "$pkgdir/etc/pisugar-server"
    mkdir -p "$pkgdir/usr/share/pisugar-server"
    cp -r web "$pkgdir/usr/share/pisugar-server"
    chmod -R 0644 "$pkgdir/usr/share/pisugar-server/web"
    install -Dm644 _ws.json -t "$pkgdir/usr/share/pisugar-server/web"
    install -Dm755 pisugar-poweroff -t "$pkgdir/usr/bin/"
    install -Dm644 pisugar-poweroff.default -t "$pkgdir/etc/default/pisugar-poweroff"
    install -Dm644 pisugar-poweroff.service -t "$pkgdir/usr/lib/systemd/system"
    install -Dm755 pisugar-programmer -t "$pkgdir/usr/bin/"
}
